{extend name="common/main"/}

{block name="body"}
<div class="message-send-list-section">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>消息发送记录</h2>
    </div>
    <div class="button-box row clearfix">

        <div class="col-md-8">
            <button type="button" class="btn btn-primary" data-name="sendMessageModal" data-iframe="{:url('send')}" data-toggle="modal" data-size="lg" data-height="600px">群发消息</button>
            <button class="btn btn-danger ajax-post confirm" url="{:url('messageStatus', ['status'=> -1])}" target-form="ids">
                删除
            </button>
        </div>
        <!-- 高级搜索 -->
        <div class="search-form col-md-4">
            <form method="get" class="form-horizontal">
                <div class="input-group">
                    <input type="text" name="keyword" class="form-control" value="{$keyword}">
                    <span class="input-group-btn">
                    <button class="btn btn-default" type="submit">搜索</button>
                    </span>
                </div>
            </form>
        </div>
    </div>

    <!-- 数据列表 -->
    <div class="data-table with-padding">
        {notempty name="lists.data"}
        <table class="table table-bordered table-striped muu-table">
            <thead>
            <tr>
                <th class="row-selected row-selected">
                    <input type="checkbox" class="check-all" id="check-all">
                    <label for="check-all"></label>
                </th>
                <th>发送方</th>
                <th>接收方</th>
                <th>内容</th>
                <th>创建时间</th>
                <th>更新时间</th>
                <th>已读</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name="lists.data" id="vo"}
                <tr>
                    <td>
                        <input class="ids" id="type_{$vo.id}" type="checkbox" name="ids[]" value="{$vo.id}"/>
                        <label for="type_{$vo.id}"></label>
                    </td>
                    <td>
                        {if !empty($vo.form_user) && $vo.form_user != -1}
                        <div class="user-info">
                            <div class="avatar">
                                <img src="{$vo.form_user.avatar64}">
                            </div>
                            <div class="nickname text-ellipsis">{$vo.form_user.nickname|text}</div>
                        </div>
                        {/if}
                    </td>
                    <td>
                        {if !empty($vo.to_uid) && !empty($vo.to_user) && $vo.to_user != -1}
                        <a class="user-info" href="{:url('admin/Member/detail',['uid'=>$vo.to_uid])}">
                            <div class="avatar">
                                <img src="{$vo.to_user.avatar64}">
                            </div>
                            <div class="nickname text-ellipsis">[{$vo.to_uid}]{$vo.to_user.nickname|text}</div>
                        </a>
                        {else}
                        <div class="user-info">用户不存在</div>
                        {/if}
                    </td>
                    <td>
                        <div class="msg-content">
                            <div class="title">{$vo.content.title}</div>
                            <div class="description">{$vo.content.description}</div>
                        </div>
                    </td>
                    <td>{$vo.create_time_str}</td>
                    <td>{$vo.update_time_str}</td>
                    <td>
                        {if $vo.is_read == 1}
                        <span class="label label-success">{$vo.is_read_str}</span>
                        {/if}
                        {if $vo.is_read == 0}
                        <span class="label label-warning">{$vo.is_read_str}</span>
                        {/if}
                    </td>
                    <td>
                        <a class="btn btn-sm btn-danger ajax-post" href="{:url('messageStatus',['status'=>-1, 'ids'=>$vo['id']])}" data-confirm="确认执行删除操作？">删除</a>
                    </td>
                </tr>
            {/volist}
            </tbody>
        </table>
        {else/}
        {include file="common/_empty"/}
        {/notempty}
    </div>

    <!-- 分页 -->
    <div class="page">
        {:htmlspecialchars_decode($pager)}
    </div>
    <!-- /分页-->
</div>
{/block}
{block name="script"}
<script>

</script>   
{/block}